"""bazelbuild/rules_rust - bzlmod example"""

module(
    name = "hello_world_example",
    version = "0.0.0",
)

bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(
    name = "bazel_skylib",
    version = "1.5.0",
)
bazel_dep(
    name = "rules_rust",
    version = "0.0.0",
)
local_path_override(
    module_name = "rules_rust",
    path = "../../..",
)

# To do third party dependencies, you have multiple options:

# Option 1: Fully transient (Cargo.toml / Cargo.lock as source of truth).
crate = use_extension(
    "@rules_rust//crate_universe:extension.bzl",
    "crate",
)
crate.from_cargo(
    name = "crates",
    cargo_lockfile = "//third-party:Cargo.lock",
    manifests = ["//third-party:Cargo.toml"],
)
use_repo(crate, "crates")
crate.annotation(
    additive_build_file = "//:anyhow.BUILD.bazel",
    crate = "anyhow",
    # Defined in additive_build_file.
    data = [":cargo_toml"],
    # Optional, you probably don't need this. Defaults to all from_cargo
    # invocations in this module.
    repositories = ["crates"],
    # Optional, you probably don't need this, defaults to "*".
    version = "*",
)

# Option 2: Vendored crates
crate_repositories = use_extension("//third-party:extension.bzl", "crate_repositories")
use_repo(crate_repositories, "vendor__anyhow-1.0.77")
